<template>
  <div>
    <!-- <img src="../../assets/agreement/jianjie.png" alt=""> -->
    <div class="authentication">

      <img src="../../assets/images/remo/real_name.png" alt="">
      <div class="reatNow" @click="approve_now">{{ authentication == 1 || authentication == 21  ? '立即认证' : '您已完成认证' }}</div> 
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      authentication: 1
    }
  },
  created () {
    this.authentication = this.$route.query.authentication
    console.log(this.authentication)
  },
  methods: {
    approve_now () {
        let approve_now = 'approve_now'
        var u = navigator.userAgent,
        app = navigator.appVersion;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //  
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //
        if (isAndroid) {
          if (this.authentication == 1 || authentication == 21 ) {
            window.android.invoke_native('auth_id', '', ''); // 未认证调用
          } else {
            window.android.invoke_native('authentication', '', '');  // 已实名跳转到已认证页面 调
          }
        } else if (isiOS) {
            window.webkit.messageHandlers.approve_now.postMessage({authentication: this.authentication});
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.authentication {
  width: 100%;
  background-size: 100% 100%;
  position: relative;
  img {
    width: 100%;
    height: auto;
    display: block;
  }
  .reatNow {
    width: 345px;
    height: 46px;
    background: #ffdd07;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #2f2f2f;
    border-radius: 30px;
    position: absolute;
    bottom: 38px;
    left: 15px;
  }
}
</style>